package entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table (name= "solicitudesInsumos")
public class SolicitudInsumoEntity implements Serializable{

	@Transient
	private static final long serialVersionUID = 1L;
	
	@Id @GeneratedValue
	private Integer id;
	@OneToMany (cascade = CascadeType.ALL)
	@JoinColumn (name= "idSolicitudInsumo")
	private List<ItemSolicitudInsumoEntity> itemsol = new ArrayList<ItemSolicitudInsumoEntity>();

	
	public SolicitudInsumoEntity() {
	}

	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public List<ItemSolicitudInsumoEntity> getItemsol() {
		return itemsol;
	}
	public void setItemsol(List<ItemSolicitudInsumoEntity> itemsol) {
		this.itemsol = itemsol;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((itemsol == null) ? 0 : itemsol.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SolicitudInsumoEntity other = (SolicitudInsumoEntity) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (itemsol == null) {
			if (other.itemsol != null)
				return false;
		} else if (!itemsol.equals(other.itemsol))
			return false;
		return true;
	}
	
	
	
}
